<?php
require('conn.php');
require('functions.php');
require('session.php');
//print_r($userdata);

?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<title>提现记录</title>
<meta name="keywords" content="<?php echo $config['sitename']?>,提现,提现记录" />
<meta name="description" content="<?php echo $config['sitename']?>提现记录查询">
<link href="<?php echo $site?>/static/all.css" type="text/css" rel="stylesheet" media="all">
<style>
td{height:40px;line-height:40px;font-size:1.3em;color:#333;}
.w33{width: 33.3%;}
.red{background-color: transparent;color: #f0585c;}
.green{background-color: transparent;color: #58f09b;}
.blue{background-color: transparent;color: #f74545;}
.darkblue{background-color: #ec3a3a;color: white;}
.br1{border-right:1px solid white;}
</style>
</head>


<body class="mhome">
<table width="100%" border="0" cellspacing="0" cellpadding="2" >
  <tr>
    <td align="center" class="darkblue w33 br1">金额</td>
    <td align="center" class="darkblue w33 br1">时间</td>
    <td align="center" class="darkblue w33">状态</td>
  </tr> 
 </table>
<?php
@session_start();
if(isset($_SESSION)){
  $_uid=$_SESSION['userdata']['id'];
}else{
  $_uid=guolv($_GET['uid']);
}
?>
<div id="loading" class="loading-wrap">
     <span class="loading">加载中，请稍后...</span>
</div>
<br><br><br><br>
<div class="positionFooter">
  <ul style="height:100%;">
    <li><a class="a4" href="<?php echo $site?>/ucenter.php"></a></li>   
    <li><a class="a2" href="<?php echo $site?>/list.php?uid=<?php echo $_uid?>"></a></li>
    <li><a class="a3" href="<?php echo $site?>/news.php?type=1"></a></li>
  </ul>
</div>
<script src="static/jquery-2.2.0.min.js"></script>
<script>
$(function(){
    var loading = $("#loading").data("on", false);
    var last = true;
    var page=2;
    var $state;
    var string;
    $(document).ready(function($) {
              $.ajax({
                    url: '<?php echo $config["site"] ?>/api/addtxlist.php',
                    type: 'GET',
                    dataType: "json",
                    data: {
                        page: 1,
                        uid: '<?php echo $session['id'] ?>',
                    },
                })
                .done(function(data){
                for (var i in data) {
                  if(data[i].state==1){
                      $state='<td align="center" class="green w33"><font>已支付</font></td>';
                    }else if(data[i].state==2){
                      $state='<td align="center" class="red w33"><font>支付失败</font></td>';
                    }else{
                      $state='<td align="center" class="blue w33"><font>审核中</font></td>';
                    }
                    string = '<tr><td class="w33 font-blue" align="center"><font>'+data[i].money+'元</font></td><td class="w33" align="center">'+data[i].time+$state+'</tr> ';
                    // console.log(string);
                $('table').append(string);
            }
          })
    });
    
    $(window).scroll(function(){
        if(loading.data("on")) return;
        if($(document).scrollTop() >= $(document).height()-$(window).height() && last){
            setTimeout(function(){
            //加载更多数据
            loading.data("on", true).fadeIn(300).delay(500);
            last = false;
            $.ajax({
                url: '<?php echo $config["site"] ?>/api/addtxlist.php',
                type: 'GET',
                dataType: "json",
                data: {
                    page: page,
                    uid: '<?php echo $session['id'] ?>',
                },
            })
            .done(function(data){
            for (var i in data) {
              if(data[i].state==1){
                  $state='<td align="center" class="green w33"><font>已支付</font></td>';
                }else if(data[i].state==2){
                  $state='<td align="center" class="red w33"><font>支付失败</font></td>';
                }else{
                  $state='<td align="center" class="blue w33"><font>审核中</font></td>';
                }
                string = '<tr><td class="w33 font-blue" align="center"><font>'+data[i].money+'</font></td><td class="w33" align="left">'+data[i].time+$state+'</tr> ';
                // console.log(string);
            $('table').append(string);
            loading.data("on", false);
            last = true;
            };
            if(data==1){
              $(".loading").html('已经全部加载'); 
              last = false;
            }

            page=page+1;
            loading.fadeOut(300);
            })
                
            },300)
            //加载更多数据
        }
    });
});
</script>

<?php
$mysql->__destruct();
$mysql->close();
?>
</body>
</html>
